# coding=utf-8
from django.conf.urls import url
from django.shortcuts import render

from blog import settings
from blog.settings import SUCCESS_URL
from . import views
from django.urls import path, reverse_lazy
from django.contrib.auth import views as auth_views
from .views import password_reset_request, password_reset_confirm

urlpatterns = [
    path('', views.IndexView.as_view(), name='index'), #跳转首页面
    path('article/<int:article_id>/', views.ArticleDetailView.as_view(), name='article_detail'),  #跳转文章详情页面
    path('article/<int:article_id>/comment/', views.CommentView.as_view(), name='comment'), #跳转所属文章的页面
    path('category/<int:category_id>/', views.getPoseByid.as_view(),name='category'), #跳转分类页面，显示分类下的文章
    path('archive/<int:year>/<int:month>/', views.getPoseCreated.as_view(),name='archive'),#跳转归档页面，显示归档下的文章
    path('tag/<str:tag>/', views.getTagArticles, name='tag_articles'),#跳转标签页面，显示标签下的文章
    path('archive/', views.getPoseCreatedList,name='archive_list'),#跳转首页总归档页面，显示归档下的文章
    path('like_comment/', views.like_comment, name='like_comment'),
    path('page/<int:num>/',views.IndexView.as_view(),name='index_page'),
    path('article/<int:article_id>/comment/<int:comment_id>/reply/', views.reply_comment, name='reply_comment'),
    path('list/', views.page_list, name='page_list'),#跳转文章列表页面
    path('add/', views.page_add, name='page_add'),#跳转文章添加页面
    path('edit/<int:id>/', views.page_edit, name='page_edit'),#跳转文章编辑页面
    path('delete/<int:id>/', views.page_delete, name='page_delete'),#跳转文章删除页面
    path('register/', views.register, name='register'),#用户注册
    path('login/',views.login_view,name= 'login'),#用户登录
    path('profile/',views.profile,name='profile'),#个人中心
    path('logout/',views.logout_view,name='logout'),#退出登录
    path('password/change/',auth_views.PasswordChangeView.as_view(
        title = settings.TITLE,
        template_name='password.html',
        extra_context={'little_title':'修改密码'},
        success_url=reverse_lazy('profile')),name='password_change'),#修改密码
    path('password/change/done/', auth_views.PasswordChangeDoneView.as_view(
        template_name='password_change_done.html'
    ), name='password_change_done'),
    path('password_reset/', views.password_reset_request, name='password_reset_request'),
    path('password_reset/done/', lambda request: render(request, 'password_reset_done.html'), name='password_reset_done'),
    path('reset/<uidb64>/<token>/', password_reset_confirm, name='password_reset_confirm'),
    path('reset/done/', lambda request: render(request, 'password_reset_complete.html'), name='password_reset_complete'),
]



